<!--
 * @Author: 梁 卓
 * @Version: V1.0.0
 * @Date: 2024-03-02 10:32:10
 * @LastEditors: 梁 卓
 * @LastEditTime: 2024-03-02 13:09:31
 * @FilePath: clubadd.html
 * Copyright 2024 Marvin, All Rights Reserved. 
 * 2024-03-02 10:32:10
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>新增俱乐部信息</title>
  <script src="../../scripts/boot.js" type="text/javascript"></script>
  <script src="../../demo/demo.css" type="text/javascript"></script>
  <style type="text/css">
    html, body
    {        
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>
  <form id="form1" method="post">
    <!-- <mini-hidden name="clubId"></mini-hidden> -->
    <fieldset style="border:solid 1px #aaa;padding:3px;">
        <legend >新增俱乐部信息</legend>
        <div style="padding:5px;">
    <table>
        <tr>
            <td align="right">俱乐部名称：</td>
            <td>    
                <input name="clubName" class="mini-textbox" required="true" />
            </td>
            <td  align="right">俱乐部负责人：</td>
            <td >
                <input name="head" class="mini-textbox" required="true"/> 
            </td>
            
        </tr>
        <tr>
            <td  align="right">创建时间：</td>
            <td >
                <input name="createTime" class="mini-datepicker" 
                value="new Date()" required="true" ondrawdate="onDrawDate"/>
            </td>
            <td  align="right">俱乐部类型：</td>
            <td >    
                <input name="clubType" class="mini-combobox" url="../../data/club.txt"
                 valueField="id" textField="text"  required="true"/>
            </td>
        </tr>   
        <tr>
            <td  align="right">余票数量：</td>
            <td >    
                <input name="remain" class="mini-textbox"
                vtype="int;range:0,500"  required="true"/>
            </td>
        </tr> 
        <tr>
            <td align="right">简介：</td>
            <td colspan="3">  
                <input name="remarks" class="mini-textarea" style="width:395px;" />
            </td>
        </tr>         
    </table>            
        </div>
    </fieldset>
    <div style="text-align:center;padding:10px;">               
        <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
        <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>           
    </div>        
</form>
<script type="text/javascript">
    mini.parse();

    var form = new mini.Form("form1");

//////////////////////////////////////////////////////////
    function onDrawDate(e) {
        var date = e.date;
        var d = new Date();

        if (date.getTime() > d.getTime()) {
            e.allowSelect = false;
        }
    }



/////////////////////////////////////////////////////////////




    function SaveData() {
        var o = form.getData();            

        form.validate();
        if (form.isValid() == false) {
            return;
        }

        var json = mini.encode(o);
        console.log('SaveData', json)
        addClubInfo(json)

        
    }

    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }

    //////////////////ajax/////////////////////////////////
    // 添加俱乐部信息接口
    function addClubInfo(json) {
        $.ajax({
            url: "/club/clubaddaction?method=addClubInfo",
            type: 'post',
            data: { data: json },
            cache: false,
            success: function (text) {
                mini.alert(text, '提示')
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
                CloseWindow();
            }
        });
    }

</script>
</body>
</html>